#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>

int main(int argc, char **argv)
{
    int fd;
    unsigned char key_vals;

    fd = open("/dev/key0", O_RDWR);

    if(fd < 0)
    {
        printf("can't open!\n");
        return 0;
    }

    while(1)
    {
        read(fd, &key_vals, 1);
        printf("key = %x\n",key_vals);
        usleep(30000);
    }

    return 0;
}
